package com.jlect.swebing.ui.laf.basic.client;

import com.jlect.swebing.ui.client.Color;
import com.jlect.swebing.ui.client.laf.LookAndFeel;
import com.jlect.swebing.ui.client.laf.UIDefaults;
import com.jlect.swebing.ui.client.laf.UIProperties;

/**
 * Default Look and Feel
 *
 * @author Sergey Kozmin
 * @since 03.12.2007 22:42:52
 */
public class BasicLookAndFeel implements LookAndFeel {
    private UIDefaults uiDefaults;

    public void initialize() {
        if(uiDefaults != null) {
            uiDefaults = new UIDefaults();
            initColors();
            initComponentUIs(uiDefaults);
        }
    }

    private void initComponentUIs(UIProperties properties) {
        uiDefaults.put("GLabel", new BasicLabelUI());
        uiDefaults.put("GContainer", new BasicContainerUI());
        uiDefaults.put("GButton", new BasicButtonUI());
    }

//    "desktop", "#005C5C", /* Color of the desktop background */
//	  "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
//      "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
//    "activeCaptionBorder", "#C0C0C0", /* Border color for caption (title bar) window borders. */
//        "inactiveCaption", "#808080", /* Color for captions (title bars) when not active. */
//    "inactiveCaptionText", "#C0C0C0", /* Text color for text in inactive captions (title bars). */
//  "inactiveCaptionBorder", "#C0C0C0", /* Border color for inactive caption (title bar) window borders. */
//	         "window", "#FFFFFF", /* Default color for the interior of windows */
//	   "windowBorder", "#000000", /* ??? */
//	     "windowText", "#000000", /* ??? */
//		   "menu", "#C0C0C0", /* Background color for menus */
//	       "menuText", "#000000", /* Text color for menus  */
//		   "text", "#C0C0C0", /* Text background color */
//	       "textText", "#000000", /* Text foreground color */
//	  "textHighlight", "#000080", /* Text background color when selected */
//      "textHighlightText", "#FFFFFF", /* Text color when selected */
//       "textInactiveText", "#808080", /* Text color when disabled */
//	        "control", "#C0C0C0", /* Default color for controls (buttons, sliders, etc) */
//	    "controlText", "#000000", /* Default color for text in controls */
//       "controlHighlight", "#C0C0C0", /* Specular highlight (opposite of the shadow) */
//     "controlLtHighlight", "#FFFFFF", /* Highlight color for controls */
//	  "controlShadow", "#808080", /* Shadow color for controls */
//        "controlDkShadow", "#000000", /* Dark shadow color for controls */
//	      "scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */
//		   "info", "#FFFFE1", /* ??? */
//	       "infoText", "#000000"  /* ??? */
    private void initColors() {
        uiDefaults.put("Menu.background", Color.LIGHT_GRAY);
        uiDefaults.put("Menu.foreground", Color.GRAY);
        uiDefaults.put("Menu.selectionForeground", Color.WHITE);
        uiDefaults.put("Menu.selectionBackground", Color.getInstance(0, 0, 80));
    }

    public void deInitialize() {
        if(uiDefaults != null) {
            uiDefaults.clear();
        }
    }

    public UIProperties getDefaultUI() {
        return uiDefaults;
    }
}
